<template>
	<view>
		<view class="list">
			<view class="item" v-for="item in assistantList" :key="item.id">
				<AssistantList :status="1" :data="item" />
			</view>
		</view>
		<view class="footer-bar">
			<FooterBar />
		</view>
	</view>
</template>

<script lang="ts" setup>
	import AssistantList from '@/componnens/teaching-list-card.vue'
	import {
		postHttpsRequset
	} from '@/public-ts-file/request'
	import { ref } from 'vue'
	import { onLoad, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'

	// 首页助教列表
	let page = ref(1)
	let assistantList = ref([])
	const getIndexAssistant = async () => {
		const parms = {
			path: `/shop/Zhujiao/zhujiaolists`,
			methods: 'post',
			data: {
				page: page.value,
				pageSize: 10,
			}
		}
		const res = await postHttpsRequset(parms)
		if (res.code == 200) {
			if (res.data.data.length) {
				assistantList.value = [...assistantList.value, ...res.data.data]
			} else {
				uni.showToast({
					title: '没有更多了',
					icon: 'none'
				})
			}
		}
		console.log(assistantList.value, 'assistantListassistantListassistantList')
	}

	onLoad(() => {
		getIndexAssistant()
	})

	onPullDownRefresh(async () => {
		page.value = 1
		assistantList.value = []
		await getIndexAssistant()
		uni.stopPullDownRefresh()
	})

	onReachBottom(() => {
		page.value++
		getIndexAssistant()
	})
</script>

<style lang="scss" scoped>
</style>